package com.huonan.jb.tools.esuse.export.utils;

import cn.hutool.core.date.DateUtil;

import java.time.LocalDate;
import java.util.LinkedList;

public class YearlyCalendar {
    public static LinkedList<String> getDaysInYear(int year) {
        LinkedList<String> dateList = new LinkedList<>();
        for (int month = 1; month <= 12; month++) {
            for (int day = 1; day <= 31; day++) {
                try {
                    LocalDate date = LocalDate.of(year, month, day);
                    String format = DateUtil.format(date.atStartOfDay(), "yyyyMMdd");
                    dateList.add(format);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        return dateList;
    }

    public static void main(String[] args) {
        //2023-07-17T16:38:43
        LinkedList<String> days = getDaysInYear(2023);
        for (String date : days) {
            System.out.println(date);
        }
    }
}